Skip to content

Extend tests with a fake Odoo server, and fix bugs they found - #64

Merged
florentx merged 8 commits into
masterfrom
test/extend-tests
Nov 27, 2026
Merged

florentx merged 8 commits into
masterfrom
test/extend-tests

Conversation

@florentx

Copy link
Copy Markdown
Member

The tests now run against a fake Odoo server, which answers each Odoo version the way the real one does. With it, the Web API, local mode, has_access, models() and render_pdf() are tested per version, and the new tests found the bugs fixed below.

Tests

  • New tests/_fake_odoo.py: FakeOdoo answers odooly's HTTP requests by path (Web API, JSON-2, doc, JSON-RPC, reports), and serves the db, common and object services for local mode. Its behaviour follows the Odoo source of each version.
  • Web API tests per version group: Odoo 9 to 13, 14 to 17, 18, and 19 to 21. Each class docstring gives the range of versions it covers.
  • Local mode: Odoo 15 joins 11, 12, 18, 19 and 20.
  • has_access, models() and render_pdf(), per version.

Fixes

  • render_pdf() with several records: Odoo ignored the context and the options.
  • render_pdf() when several reports match the name: the report with the exact name is selected. Several matches and no exact one raise "Missing report".
  • 2FA with a Webclient session works with Odoo 14 (it needed Odoo 15 before).
  • models() for a user with Odoo 15: ir.model isn't readable, so the models come from a Reference field.
  • models() for a user in local mode, with Odoo 15 and later: the Odoo exception wasn't caught.
  • Error at exit in local mode, with Odoo 14 to 17.
  • Typo in the ODOOLY_DEBUG environment variable.

Testing

  • 435 tests. Each commit passes the test suite with both HTTP backends.
  • Checked by hand against real servers in Docker: render_pdf() with Odoo 19, local mode and models() with Odoo 15.

🤖 Co-authored with Claude Code

florentx and others added 8 commits November 27, 2026 15:16
FakeOdoo answers the HTTP requests of odooly by path, per Odoo version:
Web API, JSON-2, doc, JSON-RPC, and the 'db', 'common' and 'object'
services, also used for the local mode.  FakeOdooTestCase creates it.
Changed: Odoo 14 supports 2FA with auth_totp.
Use odoo.sql_db.close_all() at exit.
No Environment.reset() and no 'neutralize_database', and models() for a
user from the Reference field.  Checked with Odoo 15.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@florentx
florentx merged commit 36c50a7 into master Nov 27, 2026
12 checks passed
@florentx
florentx deleted the test/extend-tests branch November 27, 2026 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant